<%@ page pageEncoding="UTF-8"%>

<%@ taglib uri="/tags/struts-tiles" prefix="tiles"%>
<%@ taglib uri="/tags/struts-html" prefix="html"%>
<%@ taglib uri="/tags/struts-logic" prefix="logic"%>
<%@ taglib uri="/tags/struts-nested" prefix="nested"%>
<%@ taglib uri="/tags/struts-bean" prefix="bean"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="/tags/trymore" prefix="tm"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix='fmt'%>

<style>
	.apply_0 {background-color: #DDD}
	.apply_1 {background-color: #B0DCEF}
</style>

<script type="text/javascript">
	function callback_defRemove(id) {
		navTab.reload();
	}
</script>

<form id="pagerForm" method="post" action="app/flow/def/index.do?action=pageDefIndex">
	<input type="hidden" name="pageNum" value="${pagingBean ne null ? pagingBean.currentPage : 1}" />
	<input type="hidden" name="numPerPage" value="${pagingBean ne null ? pagingBean.pageSize : 20}" />
</form>

<!-- SearchBar -->
<div class="pageHeader">
	<form onsubmit="return navTabSearch(this);" action="app/flow/def/index.do?action=pageDefIndex" method="post" id="searchForm" rel="pagerForm">
		<div class="searchBar">
			<table class="searchContent">
				<tr>
					<td>
						<label>流程模板名称：</label>
						<input type="text" name="roleName" rel="pagerForm" value="${formEntity ne null ? formEntity.defName : ''}" />
					</td>
					<td>
						<label>流程模板描述：</label>
						<input type="text" name="roleDesc" value="${formEntity ne null ? formEntity.defDescription : ''}" />
					</td>
				</tr>
			</table>
			<div class="subBar">
				<ul>
					<li><div class="buttonActive"><div class="buttonContent"><button type="submit">检索</button></div></div></li>
				</ul>
			</div>
		</div>
	</form>
</div>

<!-- Body -->	
<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
			<li><a class="add" href="app/flow/def/index.do?action=dialogFlowDefPage" target="dialog" title="添加新流程模板" mask="true" width="504" height="270" rel="dia_sys_flowadd"><span>添加新流程模板</span></a></li>
		</ul>
	</div>
	<table class="table" width="100%" layoutH="138">
		<thead>
			<tr>
				<th align="center" width="40px">序号</th>
				<th align="center">模板名称</th>
				<th align="center">模板描述</th>
				<th align="center" width="150px">创建时间</th>
				<th align="center" width="80px">运行状态</th>
				<th align="center" width="80px">流程配置</th>
				<th align="center" width="80px">编辑</th>
				<th align="center" width="80px">删除</th>
			</tr>
		</thead>
		<tbody>
			<logic:present name="datagrid">
				<logic:iterate name="datagrid" property="items" id="entity" indexId="idx">
					<tr id="drole-${role.id}" ${idx % 2 == 1 ? 'style="background-color: #F5F5F5"' : ''}>
						<td>${idx+1}</td>
						<td style="text-align:left">${entity.defName}</td>
						<td style="text-align:left">${entity.defDescription}</td>
						<td style="text-align:center"><fmt:formatDate  value="${entity.defCreationTime}" pattern="yyyy-MM-dd HH:mm:ss" /></td></td>
						<td style="text-align:center" class="apply_${entity.defApplied}">${entity.defApplied eq 1 ? '运作中' : '未运作'}</td>
						<td style="text-align:center">
							<a href="app/flow/def/index.do?action=dialogFlowDefConfPage&id=${entity.id}" target="dialog" title="`${entity.defName}`流程配置" class="oplink" width="990" height="458" rel="sysmgr_defconf_${entity.id}">配置</a>
						</td>
						<td style="text-align:center">
							<a href="app/flow/def/index.do?action=dialogFlowDefPage&id=${entity.id}" target="dialog" title="`${entity.defName}`流程编辑" class="oplink" width="504" height="250" rel="sysmgr_defedit_${entity.id}">编辑</a>
						</td>
						<td style="text-align:center">
							<a href="app/flow/def/index.do?action=actionRemoveFlowDef&id=${entity.id}" target="ajaxTodo" title="确定删除该流程模板吗？" class="oplink" callback="callback_defRemove(${entity.id})">删除</a>
						</td>
					</tr>
				</logic:iterate>
			</logic:present>
		</tbody>
	</table>
	
	<!-- Pagination -->
	<div class="panelBar">
		<div class="pages">
			<span>显示</span>
			<select class="combox" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value})">
				<option value="20" ${pagingBean ne null && pagingBean.pageSize eq 20 ? 'selected="selected"' : ''}>20</option>
				<option value="50" ${pagingBean ne null && pagingBean.pageSize eq 50 ? 'selected="selected"' : ''}>50</option>
				<option value="100" ${pagingBean ne null && pagingBean.pageSize eq 100 ? 'selected="selected"' : ''}>100</option>
				<option value="200" ${pagingBean ne null && pagingBean.pageSize eq 200 ? 'selected="selected"' : ''}>200</option>
			</select>
			<span>条，共${pagingBean ne null ? pagingBean.totalItems : 0}条</span>
		</div>
		
		<div class="pagination" targetType="navTab" totalCount="${pagingBean ne null ? pagingBean.totalItems : 0}" numPerPage="${pagingBean ne null ? pagingBean.pageSize : 20}" pageNumShown="${pagingBean ne null ? pagingBean.pageNumShown : 10}" currentPage="${pagingBean ne null ? pagingBean.currentPage : 1}"></div>

	</div>
		
</div>